package com.limingfeiyu.common.web;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import java.util.Map;

/**
 * @Author: 黎铭飞羽
 * @Data: 2024-03-01 :   8:33
 * @Description:
 */
@Data
public class PageTable <T> {
    private Integer currentPage = 1; //  当前页数
    private Integer pageSize = 20; // 每页显示条目个数
    private Integer total = 0; // 总条目数
    private Integer pagerCount = 10; // 页码按钮的数量，当总页数超过该值时会折叠
    /**
     * 实体参数
     */
    private T param;
    /**
     * 其他 参数
     */
    private Map<String, Object> otherParam;

    private Page<T> page;


    public Page<T> getPage() {
        if (this.page == null) {
            this.page = new Page<>();
        }
        this.page.setCurrent(this.currentPage);
        this.page.setSize(this.pageSize);
        return this.page;
    }
}
